/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hue;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Hue
 */
public class CallbackServlet extends OpenURL {
    
    @Override
    public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
        super.process(request, response);
        
        String requestURI = request.getRequestURI();
        if(request.getQueryString() != null) {
             requestURI += "?" + request.getQueryString();
        }
        String url = SERVER_URL + requestURI;
        if("POST".equals(request.getMethod())) {
            httpPost(request, response, url, response.getOutputStream());
        }
        else {
            httpGet(request, response, url, response.getOutputStream());
        }
    }
}
